<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="shoppingcart.aspx.cs" Inherits="shoppingcart" Title="Shopping Cart" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

    

    <asp:Label ID="lblMessage" runat="server" EnableViewState="true"/>
    <table  width="520px" cellpadding="10px">
        <tr>
            <td>
                <img id="img1" src="CoreLayout/Images/Icon-Cart.gif" alt="Cart"/>
            </td>
            <td>
                <b style="font-size:xx-large; font-weight:lighter; font-style:italic; margin-left:10px">My Cart</b>
            </td>
            <td style="text-align:center">
                <asp:Label ID="lblSubTotal1" runat="server" />
            </td>
            <td>
                <asp:ImageButton id="ibtnCheckOutTop" ImageUrl="CoreLayout/Images/btn_checkout.png" runat="server" OnClick="ibtnCheckOutTop_Click" />
            </td>
        </tr>
    </table>
        
    <asp:Panel ID="panelCart" runat="server">
    <asp:GridView ID="gvCart" runat="server"  GridLines="None" AutoGenerateColumns="False" CellPadding="10" Width="520px" 
                    CssClass="myGridView" OnRowCommand="gvCart_RowCommand" >        
            <Columns> 
                <asp:ImageField DataImageUrlField="Picture" ControlStyle-Width="70px" 
                        ControlStyle-Height="70px" ControlStyle-BorderStyle="solid" ControlStyle-BorderWidth="1px" ControlStyle-BorderColor="Chocolate">
                    <ItemStyle HorizontalAlign="Left"/>
                </asp:ImageField>
                
                <asp:TemplateField HeaderText="Product Title" SortExpression="Name">
                    <ItemTemplate>
                        <b style="text-decoration:underline;"><asp:Label ID="lblProductName" runat="server" Text='<%# Bind("Name") %>' /><b><br /><br />
                        <asp:ImageButton ID="ibtnRemove" runat="server" ImageUrl="~/CoreLayout/Images/btn_remove.png"
                                CommandName="Remove" CommandArgument='<%# Bind("ItemId") %>' />
                        <asp:HiddenField ID="hiddenLine" runat="server" Value ='<%# DataBinder.Eval(Container.DataItem, ("Line")) %>' />
                        <asp:HiddenField ID="hiddenItemID" runat="server" Value='<%# DataBinder.Eval(Container.DataItem, ("ItemId")) %>' />
                    </ItemTemplate>
                    <HeaderStyle HorizontalAlign="Left" />
                </asp:TemplateField>
                
                <asp:BoundField DataField="Price" HeaderText="Price" SortExpression="Price" DataFormatString="{0:c}" >
                    <ItemStyle HorizontalAlign="Center" VerticalAlign="Top" ForeColor="OrangeRed"/>
                </asp:BoundField>
                
                <asp:TemplateField HeaderText="Qty" SortExpression="Quantity">
                    <ItemTemplate>
                        <asp:TextBox ID="txtQuantity" runat="server" Text='<%# Bind("Quantity") %>' Width="20px"  MaxLength="2" />
                        <b style="color:Red"><asp:Label ID="lblError" runat="server" /></b>
                    </ItemTemplate>
                    <ItemStyle HorizontalAlign="Center" VerticalAlign="Top" />
                </asp:TemplateField>
                
                <asp:BoundField DataField="Subtotal" HeaderText="Cost" SortExpression="Subtotal" DataFormatString="{0:c}" >
                    <ItemStyle HorizontalAlign="Center" VerticalAlign="Top" ForeColor="OrangeRed" />
                </asp:BoundField>                
            </Columns>                                              
        <HeaderStyle BackColor="#d8d8d8" />
    </asp:GridView><br />
    <p><asp:Label ID="lblCartError" runat="server" ForeColor="Red" /></p>        
    <table width="520px" style="margin-bottom:20px">
        <tr>
            <td>
                <asp:Label ID="lblUSD" runat="server" Font-Italic="true" Font-Size="X-Small" Width="200px"/>
                <asp:Panel ID="panelDiscount" runat="server" Width="200px"> 
                    <i style="font-size:small; color:Maroon">According to our dealer policy, your discount percentage is:</i>
                    <asp:Label ID="lblDiscount" runat="server"/>                                 
                </asp:Panel>
            </td>
            <td style="vertical-align:text-top;">
                <p>
                    <b>Total : </b><br /><br />
                    <b>Discount : </b><br /><br />
                    <b>Subtotal : </b><br /><br />
                </p>
            </td>
            <td style="vertical-align:text-top; text-align:right">
                <p>
                    <asp:Label ID="lblSubtotal" runat="server" ForeColor="Red"/><br /><br />
                    <asp:Label ID="lblPercent" runat="server" Font-Italic="true" ForeColor="RED" /><br /><br />
                    <asp:Label ID="lblFinalSubtotal" runat="server" Font-Bold="true" ForeColor="RED" /><br />
                </p>
                
            </td>
        </tr>
        <tr>
            <td>
                <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/CoreLayout/Images/btn_continue_shopping.png" OnClick="ibtnContinueShopping_Click" />                
            </td>
            <td>
                <asp:ImageButton ID="ibtnUpdate" runat="server" ImageUrl="~/CoreLayout/Images/btn_update-1.png"  
                                CommandName="Update" OnClick="ibtnUpdate_Click" />
            </td>                  
            <td style="text-align:center">                                
                <asp:ImageButton ID="ibtnCheckOut" runat="server" ImageUrl="~/CoreLayout/Images/btn_checkout.png" OnClick="ibtnCheckOut_Click" />
            </td>
        </tr>
    </table>        
    </asp:Panel>
    
</asp:Content>

